<?php

namespace App\Http\Controllers;

use App\Models\Setting;
use Illuminate\Http\Request;

class SettingController extends Controller
{
    public function about(){
        return [
            'code' => 200,
            'message' => '请求成功',
            'data' => \App\Models\Setting::find(1)->guanyu
        ];
    }
    public function agreement(){
        return [
            'code' => 200,
            'message' => '请求成功',
            'data' => \App\Models\Setting::find(1)->yonghuxieyi
        ];
    }
    public function yinsi(){
        return [
            'code' => 200,
            'message' => '请求成功',
            'data' => \App\Models\Setting::find(1)->yinsi
        ];
    }
    public function contactPhone(){
        return [
            'code'=>200,
            'message'=>'请求成功',
            'data'=>Setting::find(1)->lianxidianhua
        ];
    }
    public function lunbo(){
        return [
            'code'=>200,
            'message'=>'请求成功',
            'data'=>collect(Setting::find(1)->lunbo)->map(function ($item){
                return \Storage::url($item);
            })
        ];
    }
    public function hotKey(){
        return [
            'code'=>200,
            'message'=>'请求成功',
            'data'=>explode(',',Setting::find(1)->hot_key)
        ];
    }
}
